﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>


<?php

include("inc/joomlaInt.php");
include("inc/inc_configuration.php");

if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{	

// Alle Trainerwechsel

	$abfrage = "SELECT 
					tr.type AS type, 
					t.name AS tN,
					u.username AS uN,
					u.id AS uid,
					tr.date AS tDate,
					tr.reason AS reason,
					tr.id AS id,
					lt.leagueId AS leagueId,
					t.id AS tId
				FROM 
					$tbl_combinations c,
					$tbl_trainerwechsel tr,
					$tbl_teams t,
					$tbl_users u,
					$tbl_lt lt,
					$tbl_leagues l
				WHERE
					tr.combinationId=c.id AND
					c.teamId=t.id AND
					c.userId=u.id AND
					lt.teamId=t.id AND
					lt.leagueId=l.id AND
					l.type=1
				ORDER BY tDate DESC
				LIMIT 0, 20 ";
	$ergebnis = mysql_query($abfrage);

	echo "<table id='tborder' bgcolor='#DADADA'>
			<tr id='tabelle'>
				<th>Liga</th>
				<th></th>
				<th>Team</th>
				<th></th>
				<th>User</th>
				<th>Datum</th>
				<th>Grund</th>
			</tr>";
			
		
		
	while ($row = mysql_fetch_object($ergebnis))
	{	
		$t=$row->type;
		$tid=$row->tId;
		$uid=$row->uid;
		$liga=$row->leagueId;
		
		$lpq="SELECT lp.path AS path FROM $tbl_leagues l, $tbl_leaguepics lp WHERE l.id=$liga AND l.picId=lp.id";
		$lpqe=mysql_query($lpq);
		$lpqeo=mysql_fetch_object($lpqe);
		$path=$lpqeo->path;
		
		if ($t==1)
		{
			$type="<img width='30' height='30' src='img/arrow_green.png' alt='Übernahme'>";
		}
		else
		{
			$type ="<img width='30' height='30' src='img/arrow_red.png' alt='Abgabe'>";
		}
		echo"<tr><td><img width='30' height='30' src='$leaguelogo_s_path$path' alt='Liga'></td>";
		echo"<td>",$type,"</td>";
		echo"<td><a href='team_kader.php?team=$tid'><img src='$logopath",$tid,".png' width='$teamlogo_s_size' height='$teamlogo_s_size' alt=''></a></td>";
		echo"<td><a href='spiele_team.php?team=$tid&liga=$liga'>",$row->tN,"</a></td>";
		echo"<td><a href='profil.php?id=$uid'>",$row->uN,"</a></td>";
		$tDate=$row->tDate;
		$zeit = date("d.m.Y - H:i",$tDate);
		echo"<td>",$zeit,"</td>";
		echo"<td>",$row->reason,"</td></tr>";
	}
	echo"<tr id='tabelle'><th colspan='7'></th></tr></table>";
	
	echo "<br><br>
			<center><a href='lima.php' class='button zurueck'>Zurück</a></center>";
}
?>

</body>
</html>